<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('工单管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                类型： <select name="status">
                                <option value="">检修</option>
                                <option value="0">检修</option>
                                <option value="1">业务报修</option>
                            </select>
                            </li>
                            <li>
                                厂家： <select name="status">
                                <option value="">A厂家</option>
                                <option value="0">B厂家</option>
                                <option value="1">C厂家</option>
                            </select>
                            </li>
                            <li>
                                <label>设备：</label>
                                <input type="text" name="matename"/>
                            </li>
                            <li>
                                <label>检查人：</label>
                                <input type="text" name="checker"/>
                            </li>
                            <li>
                                <label>状态：</label>
                                <input type="text" name="status"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" >
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:gongdan:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:gongdan:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${true}]];
        var removeFlag = [[${true}]];
        var prefix = ctx + "system/gongdan";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "工单管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'bianhao',
                    title: '工单编号'
                },
                {
                    field: 'pubDate',
                    title: '发布日期'
                },
                {
                    field: 'dname',
                    title: '工单名称'
                },
                {
                    field: 'matename',
                    title: '设备'
                },
                {
                    field: 'content',
                    title: '工单内容'
                },
                {
                    field: 'type',
                    title: '工单类型'
                },
                {
                    field: 'company',
                    title: '单位'
                },
                {
                    field: 'zhanshi',
                    title: '配电室'
                },
                {
                    field: 'checker',
                    title: '检查人'
                },
                {
                    field: 'executedate',
                    title: '执行日期'
                },
                {
                    field: 'finishdate',
                    title: '结束日期'
                },
                {
                    field: 'prio',
                    title: '优先级'
                },
                {
                    field: 'status',
                    title: '状态'
                },
                {
                    field: 'tips',
                    title: '处理说明'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>
